package MOLE.Pay;

import MOLE.*;

/** 
 AlipaySend ��ժҪ˵����
*/
public class AlipaySend
{

	private MOLE.Alipay.CommInfo o = new MOLE.Alipay.CommInfo();

	public AlipaySend(java.math.BigDecimal fee)
	{
		o.partner = MOLE.GetValue.GetConfigString("ZifubaoID");
		o.key = MOLE.GetValue.GetConfigString("key");
		o.return_ur = MOLE.GetValue.GetConfigString("UrlReturn");
		o.notify_url = MOLE.GetValue.GetConfigString("UrlNotify");
		o.trade_no = MOLE.comm.getRandom();
		o.subject = "ʱʱ�ʳ�ֵ";
		o.body = "ʱʱ�ʳ�ֵʹ��֧����֧��";
		o.quantity = "1";
		o.total_fee = fee.toString();
		o.seller_email = MOLE.GetValue.GetConfigString("email");
		o.show_url = "http://www.shishicai.cn";

	}


	public final String GetPaygateUrl()
	{
	//	add order
		Order od = new Order();
		od.Oid = Long.parseLong(o.trade_no);
		od.money = (java.math.BigDecimal)o.total_fee;
		od.paytype = "alipay";
		od.Add();

		 MOLE.Alipay.Alipay a = new MOLE.Alipay.Alipay(o);
		  return a.CreatUrl();
	}


static public boolean MoneyCheckPass(String money)
{

		java.math.BigDecimal fee = new java.math.BigDecimal(0);
		try
		{
			fee = (java.math.BigDecimal)money;

		}
		catch (java.lang.Exception e)
		{

		}

	if (fee.compareTo(0) <= 0)
	{
		return false;
	}
	else if (fee.compareTo(99999999) > 0)
	{
		return false;
	}
	else
	{
		return true;
	}
}






}